//
//  YXDeviceRecorder.h
//  MiaoPaiVideoKitSample
//
//  Created by Makarov on 2017/8/30.
//  Copyright © 2017年 Makarov. All rights reserved.
//

#import <AVFoundation/AVFoundation.h>

@class YXDeviceRecorder;

@protocol YXDeviceRecorderDelegate <NSObject>

- (void)deviceRecorderInterrupt:(YXDeviceRecorder *)deviceRecorder;
- (void)deviceRecorder:(YXDeviceRecorder *)deviceRecorder didRecordDuration:(CGFloat)duration;
- (void)deviceRecorder:(YXDeviceRecorder *)deviceRecorder didRecordVideoAtPath:(NSString *)videoPath;
- (void)deviceRecorderDidStartRecord:(YXDeviceRecorder *)deviceRecorder;

@end

@interface YXDeviceRecorder : NSObject


/**
 录制目录
 */
@property (nonatomic, strong) NSString *videoStorageDirectory;


/**
 录制前缀
 */
@property (nonatomic, strong) NSString *videoIdentifier;


/**
 期望帧率 缺省30fps
 */
@property (nonatomic, assign) float expectVideoFrameRate;


/**
 期望编码后视频分辨率大小
 */
@property (nonatomic, assign) CGSize expectVideoSize;


/**
 期望码率 缺省按照屏幕大小自动配置
 */
@property (nonatomic, assign) float expectVideoBitrate;
@property (nonatomic, weak) id<YXDeviceRecorderDelegate> delegate;


/**
 录制的视频的横竖依赖于设备方向
 */
@property (nonatomic, assign) BOOL orientateToDevice;

- (void)startRecord;
- (void)stopRecordWithCompleteHandler:(void (^)())handler;
- (void)cancelRecord;

/**
 不录制音频不用设置调用

 @param time 不录制音频不用设置调用
 */
- (void)updateSessionTime:(CMTime)time;
- (void)appendAudioBuffer:(CMSampleBufferRef)audioBuffer;

@end
